import React, { Component } from 'react';
import {
  View,
  Text,
  Image,
  ListView,
  TouchableOpacity,               //底部刷新小组件
} from 'react-native';

import { selecttwoStyle as styles } from '../../../../../styles';
import Icon from 'react-native-vector-icons/Ionicons';
const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => { r1 !== r2 } });//listView 数据判断方式
export default class Selecttwo extends Component {
  // 初始化模拟数据
  constructor(props) {
    super(props);
  }

  render() {
    //创建listView数据源
    const dataSource = ds.cloneWithRows(this.props.dataSource);
    return (
      <View style={styles.selcenterall}>
        <Text style={styles.selhist}>历史记录</Text>
        <ListView
          dataSource={dataSource}
          renderRow={this.renderRow.bind(this)}
          onEndReachedThreshold={1}
          enableEmptySections={true}
        />
      </View>
    );
  }

  renderRow(rowData) {
    return (
      <View style={styles.selcenterallin}>
        <Icon
          name={'md-time'}
          size={15}
          color={'#949494'}
          style={styles.seltime} />
        <TouchableOpacity
          activeOpacity={0.5}//透明度
          onPress={() => {
            const aa = {
              page: 1,
              likeStr: rowData,
              workspace: this.props.workspace,
            }
            this.props.actions.SelposMobAction(aa);
            this.props._likeStr(rowData);
            this.props.hopstate();
          }}
          activeOpacity={1}>
          <Text style={styles.selcentername}>{rowData}</Text>
        </TouchableOpacity>

        <TouchableOpacity style={styles.selclose}
          onPress={() => { this.props.delhis(rowData) }} activeOpacity={1}>
          <Icon
            name={'md-close'}
            size={15}
            color={'#949494'} />
        </TouchableOpacity>
      </View>
    )
  }
} 